// import 'mmDux';
import 'avalon2';
import 'mmRouter';
import mmDux from './../../static/mmDux-master/dist/mmDux.js';
require("./components/header/header")
// window.api = require("./service.js")
// 
require("./components/footer/footer")

var userReducer = function (state = {}, action) {
    state = state || {name:""}

    console.log('userReducer was called with state', state, 'and action', action)
    switch (action.type) {
        case 'SET_NAME':
            return avalon.mix({},state,{
                name: action.name,
                setting:action.setting
            })
        default:
            return state;
    }
}
var itemsReducer = function (state, action) {
    state = state || []
    console.log('itemsReducer was called with state', state, 'and action', action)
    switch (action.type) {
        case 'ADD_ITEM':
            return avalon.mix([],state,action.item)
        default:
            return state;
    }
}
var createStore = mmDux.createStore
var combineReducers = mmDux.combineReducers
var reducer = combineReducers({
    user: userReducer,
    items: itemsReducer
})
var store_0 = createStore(reducer)
console.log("\n", '### It starts here')
console.log('store_0 state after initialization:', store_0.getState())
store_0.dispatch({
    type: 'AN_ACTION'
})

window.duxStore = store_0
